﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using ControlModule.Models;

namespace ControlModule.Daos
{
    public class AnswerDao
    {
        public static List<Answer> LoadAnswersByQuestionId(int questionId)
        {
            using (CmDbEntities db = new CmDbEntities())
                return (
                    from a in db.Answer
                    from r in db.RelQuestionAnswer
                    where r.AnswerId == a.Id
                    where r.QuestionId == questionId
                    select a).ToList();
        }
    }
}